package com.simple.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Entity
@DynamicInsert
@Table(name="sys_user")
@NoArgsConstructor
@AllArgsConstructor
public class SysUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name="id",unique=true,nullable=false)
    private Integer id;
    @Column(name="head_portrait")
    private String headPortrait;//头像
    @Column
    private String username;//帐户名
    @Column
    private String email;//邮箱
    @Column
    private String password;//密码
    @Column
    private Integer status;//激活状态0未激活1已激活
    @Column(name="online_status")
    private Integer onlineStatus;//在线状态0未在线1在线
    @Column(name="create_date")
    private Date createDate;//创建时间
    @Column(name="del_status")
    private Integer delStatus=0;//删除状态
    @ManyToOne(cascade= {CascadeType.MERGE})//默认立刻加载
    @NotFound(action= NotFoundAction.IGNORE)
    @JoinColumn(name="role_id")
    private SysRole sysRole;//角色

}
